
package com.rx.mgt.dao;  

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.rx.mgt.dao.base.ManagementHibernateDaoBase;
import com.rx.mgt.domain.SysLog;
import com.rx.mgt.po.UsersBo;

/** 
 * ClassName:SysLogDao 
 * Function :
 * Reason   : 
 * Date     :Feb 6, 2017 3:01:31 PM 
 * @author   luolei 
 * @since    JDK 1.6
 */
@Repository
public class SysLogDao extends ManagementHibernateDaoBase<SysLog, Long>{
    @Transactional(readOnly=true)
    public List getAllLog(UsersBo usersBo){
        String hql= " from SysLog au where 1=1  ";
        if(StringUtils.isNotBlank(usersBo.getContent())){
            hql=hql +" and au.content=:content";
        }
        Query query = template.getSessionFactory().getCurrentSession().createQuery(hql);
        if(StringUtils.isNotBlank(usersBo.getContent())){
            query.setParameter("content", usersBo.getContent());
        }
        return query.list();
    }

}
  